From: Florian Müllner Date: Thu, 29 Jul 2021 20:17:54 +0000 (+0200) Subject: magnifier: Small cleanup X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~574^2^2~159 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8f42053b5fde050dc98e459009eb476f86a86380;p=gnome-shell.git magnifier: Small cleanup Use an early return instead of a big if() block to cut down on indentation. Part-of: --- diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index 57b32cb05..22581278d 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -232,20 +232,21 @@ var Magnifier = class Magnifier { scrollToMousePos(...args) { const [xMouse, yMouse] = args.length ? args : global.get_pointer(); - if (xMouse != this.xMouse || yMouse != this.yMouse) { - this.xMouse = xMouse; - this.yMouse = yMouse; - - let sysMouseOverAny = false; - this._zoomRegions.forEach(zoomRegion => { - if (zoomRegion.scrollToMousePos()) - sysMouseOverAny = true; - }); - if (sysMouseOverAny) - this.hideSystemCursor(); - else - this.showSystemCursor(); - } + if (xMouse === this.xMouse && yMouse === this.yMouse) + return; + + this.xMouse = xMouse; + this.yMouse = yMouse; + + let sysMouseOverAny = false; + this._zoomRegions.forEach(zoomRegion => { + if (zoomRegion.scrollToMousePos()) + sysMouseOverAny = true; + }); + if (sysMouseOverAny) + this.hideSystemCursor(); + else + this.showSystemCursor(); } /**